package org.springblade.modules.repair.controller; /**
 * @author Jackey
 * @description TODO
 * @date 2021-12-31 11:05
 */

import com.aliyuncs.exceptions.ClientException;
import org.springblade.core.tool.api.R;
import org.springblade.modules.repair.service.StsTokenService;
import org.springblade.modules.repair.vo.StsTokenVo;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author Jackey
 * @date 2021年12月31日 11:05
 */
@RestController
@RequestMapping("/sts")
public class StsController {

	@Resource
	private StsTokenService stsTokenService;

	@GetMapping()
	@CrossOrigin
	public R<StsTokenVo> getStsToken() throws ClientException {
		StsTokenVo stsToken = stsTokenService.getStsToken();
		return R.data(stsToken);
	}

	@GetMapping("/signature")
	@CrossOrigin
	public R<Map<String, Object>> getSignature() {
		Map<String, Object> resultMap = stsTokenService.getSignature();
		return R.data(resultMap);
	}
}
